home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gimp.idb / usr / freeware / share / gimp / scripts / chip-away.scm.z / chip-away.scm
Encoding:
GIMP Script-Fu Script  |  1999-07-21  |  5.0 KB  |  135 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ;  Supposed to look vaguely like roughly carved wood. Chipped away if you will.
  5. ;
  6. ;  Options: Text String -  the string to make the logo from
  7. ;           Font        -  which font to use
  8. ;           Font Size   -  how big
  9. ;           Chip Amount - how rought he chipping is (how spread the bump map is)
  10. ;           Blur Amount - the bump layer is blurred slighty by this amount
  11. ;           Invert      - whether or not to invert the bumpmap (gives a carved in feel)
  12. ;           Drop Shadow - whether or not to draw a drop shadow
  13. ;           Keep bump layer? - whether to keep the layer used as the bump map
  14. ;           fill bg with pattern? - whether to fill the background with the pattern or leave it white
  15. ;           Keep Backgroun - whether or not to remove the background layer
  16. ;  Adrian Likins  (Adrian@gimp.org)
  17. ;  Jan 11, 1998 v1
  18. ;
  19. ;  see http://www.gimp.org/~adrian/script.html
  20. ;
  21. ; This program is free software; you can redistribute it and/or modify
  22. ; it under the terms of the GNU General Public License as published by
  23. ; the Free Software Foundation; either version 2 of the License, or
  24. ; (at your option) any later version.
  25. ; This program is distributed in the hope that it will be useful,
  26. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  28. ; GNU General Public License for more details.
  29. ; You should have received a copy of the GNU General Public License
  30. ; along with this program; if not, write to the Free Software
  31. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  32. ;
  33. ;  Some suggested patterns: Dried mud, 3D green, Slate
  34. ;
  35.  
  36. (define (script-fu-logo-chip-away text font font-size spread-amount blur-amount invert drop-shadow keep-bump bg-fill keep-back pattern)
  37.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  38.      (text-layer (car (gimp-text img -1 0 0
  39.                      text 30 TRUE font-size PIXELS
  40.                      "*" font "*" "*" "*" "*")))
  41.      (width (car (gimp-drawable-width text-layer)))
  42.      (height (car (gimp-drawable-height text-layer)))
  43.      (bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
  44.      (bump-layer (car (gimp-layer-new img width height RGBA_IMAGE "Bump Layer" 100 NORMAL)))
  45.      (old-fg (car (gimp-palette-get-foreground)))
  46.      (old-bg (car (gimp-palette-get-background))))
  47.     
  48.     (gimp-image-disable-undo img)
  49.     (gimp-image-resize img width height 0 0)
  50.     (gimp-image-add-layer img bg-layer 1)
  51.     (gimp-layer-set-preserve-trans text-layer TRUE)
  52.     (gimp-patterns-set-pattern pattern)
  53.  
  54.     (gimp-palette-set-background '(255 255 255))
  55.     (gimp-selection-all img)
  56.  
  57.     (if (= bg-fill TRUE)
  58.     (gimp-bucket-fill img bg-layer 2 NORMAL 100 255 FALSE 1 1)
  59.     (gimp-edit-fill img bg-layer))
  60.  
  61.     (gimp-selection-all img)
  62.     (gimp-edit-clear img bump-layer)
  63.     (gimp-selection-none img)
  64.     (gimp-selection-layer-alpha img text-layer)    
  65.     (gimp-edit-fill img bump-layer)
  66.     (gimp-bucket-fill img text-layer 2 NORMAL 100 255 FALSE 1 1)
  67.     (gimp-selection-none img)
  68.     
  69.     (gimp-image-add-layer img bump-layer 1)
  70.  
  71.     (gimp-layer-set-preserve-trans bump-layer FALSE)
  72.     (plug-in-spread 1 img bump-layer spread-amount spread-amount)
  73.     (gimp-selection-layer-alpha img bump-layer)
  74.     (plug-in-gauss-rle 1 img bump-layer blur-amount TRUE TRUE)
  75.    
  76.     (gimp-selection-none img)
  77.     
  78.     (plug-in-bump-map 1 img text-layer bump-layer 135.00 25.0 60 0 0 0 0 TRUE invert 1)
  79.  
  80.     (gimp-layer-set-visible bump-layer FALSE)
  81.  
  82.      (if (= drop-shadow TRUE)
  83.     (begin
  84.       (let* ((shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Shadow layer" 100 NORMAL))))
  85.         (gimp-selection-all img)
  86.         (gimp-edit-clear img shadow-layer)
  87.         (gimp-selection-none img)
  88.         (gimp-selection-layer-alpha img text-layer)
  89.         (gimp-palette-set-background '(0 0 0))
  90.         (gimp-edit-fill img shadow-layer)
  91.         (gimp-selection-none img)
  92.         (plug-in-gauss-rle 1 img shadow-layer 5 TRUE TRUE)
  93.         (gimp-image-add-layer img shadow-layer 1)
  94.         (gimp-layer-translate shadow-layer 6 6))))
  95.  
  96.      (if (= keep-bump FALSE)
  97.      (gimp-image-remove-layer img bump-layer))
  98.  
  99.    
  100.  
  101.      (if (= keep-back FALSE)
  102.      (gimp-image-remove-layer img bg-layer))
  103.     
  104.     (gimp-palette-set-foreground old-fg)
  105.     (gimp-palette-set-background old-bg)
  106.     (gimp-image-enable-undo img)
  107.     (gimp-display-new img)
  108.     
  109.     ))
  110.  
  111.  
  112. (script-fu-register "script-fu-logo-chip-away"
  113.             "<Toolbox>/Xtns/Script-Fu/Logos/Chip Away"
  114.             "Chip away effect"
  115.             "Adrian Likins <adrian@gimp.org>"
  116.             "Adrian Likins <adrian@gimp.org>"
  117.             "1997"
  118.             ""
  119.             SF-VALUE "Text String" "\"Sloth\""
  120.             SF-VALUE "Font" "\"roostheavy\""
  121.             SF-VALUE "Font size" "200"
  122.             SF-VALUE "Chip Amount" "30"
  123.             SF-VALUE "Blur Amount" "3"
  124.             SF-TOGGLE "Invert?" FALSE
  125.             SF-TOGGLE "Drop Shadow?" TRUE
  126.             SF-TOGGLE "Keep Bump layer?" FALSE
  127.             SF-TOGGLE "Fill bg with pattern?" TRUE
  128.             SF-TOGGLE "Keep Background?" TRUE
  129.             SF-VALUE "Pattern" "\"Burlwood\"")
  130.  
  131.  
  132.